Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FRONT-1978: Update @streamr/config to the "typed" version (v5.5.0) + clean up #1974

Conversation

mondoreale
Copy link
Collaborator

@mondoreale mondoreale commented Feb 7, 2025

In this PR I make sure we're using the latest @streamr/config package (exposes proper types for the config and chains). I also clean things up a bit. There's room for more but I don't wanna pollute it just yet (#1965 could be addressed first).

Future improvement material

  • The new config package exposes ChainKey (polygon, dev0, …) which could be use to narrow hub's types even further.

Isolating this change may cause some mess. Will fix it shortly.
@mondoreale mondoreale requested a review from tumppi February 7, 2025 14:29
Copy link

linear bot commented Feb 7, 2025

@@ -17,7 +17,7 @@ export default function getClientConfig(
if (chainConfig.entryPoints && chainConfig.entryPoints.length > 0) {
config.network = {
controlLayer: {
entryPoints: chainConfig.entryPoints,
entryPoints: [...chainConfig.entryPoints],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

controlLayer.entryPoints is a mutable collection while chainConfig.entryPoints is a read-only collection. ts rightfully complains.

@@ -97,8 +97,6 @@ export function getContractAddress(
return contracts.SponsorshipStakeWeightedAllocationPolicy
case 'sponsorshipVoteKickPolicy':
return contracts.SponsorshipVoteKickPolicy
case 'sponsorshipPaymentToken':
return contracts.SponsorshipPaymentToken
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! sponsorshipPaymentToken is properly resolved by this switch earlier. This here is redundant, plus, sponsorshipPaymentToken doesn't exist on contracts anyway.

Issue detected by the typed config. Pretty cool.

@mondoreale mondoreale marked this pull request as ready for review February 7, 2025 14:35
Copy link
Contributor

@tumppi tumppi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! The old way was prone to errors. Good to have this now.

@mondoreale mondoreale merged commit be38188 into master Feb 11, 2025
9 checks passed
@mondoreale mondoreale deleted the front-1978-update-streamrconfig-to-the-typed-version-v550-clean-up branch February 11, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants